<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>产品详情</title>
    <script src="assets/js/jquery-3.2.1.min.js"></script>
    <script src="assets/js/code/code_amazon.js"></script>
    <script src="assets/js/base.js"></script>
    <script src="assets/js/ajax.helper.js" type="text/javascript"></script>
    <script src="assets/js/xcConfirm.js"></script>
    <script src="assets/js/popwin.js"></script>
    <script src="assets/js/imgmove.js"></script>
    <script src="assets/js/js.js"></script>
    <script src="assets/js/purchase/purchase.js"></script>
    <LINK href="assets/css/css.css" type=text/css rel=stylesheet>
    <style>
        .tbi label{ font-weight:bold; margin-left:5px; color:#555}
        .lbl{ margin:0 5px 0 16px;}
    </style>
</head>
<body style="margin:0">
<div class="mv" style=" margin:10px 0 0 0;padding:0px">
    <!--标题-->
    <div class="mt" style="top:0;height:100px">
        <div class="mt0">商品商品编辑</div>
        <div class="mt1" style="padding-bottom:10px;">
            <table class="tbi">
                <tr>
                    <td width="80">ID<label id="sku">4532999</label></td>
                    <td width="90">状态<label id="editStatus">编辑完成</label></td>
                    <td width="170">入库时间<label id="createon">2018-08-22 12:03</label></td>
                    <td width="150">来源<label id="source">ChinaBrads</label></td>
                    <td>原链<label><a id="from" href="https://detail.1688.com/offer/535880049959.html?spm=a262gg.8864560.jifoyla0.6.4b156510XPcQfF" target="_blank">https://detail.1688.com/offer/535880049959.html?spm=a262gg.8864560.jifoyla0.6.4b156510XPcQfF</a></label></td>
                </tr>
            </table>
        </div>
    </div>
    <!--//标题-->
    <div id="content" style="padding-bottom:20px;">
        <!--Tab-->
        <div id="tabtit" style="margin-top:120px;">
            <div class="tab1" id="tab0" onClick="clkTab(0)">相册</div>
            <div class="tab0" id="tab1" onClick="clkTab(1)">属性</div>
            <div class="tab0" id="tab2" onClick="clkTab(2)">文描</div>
        </div>
        <!--//Tab-->
        <!--相册-->
        <style>
            #imgUl {width:90%; height:600px; margin:0px 0 0 30px; }
            #imgUl li {width:200px; height:200px; float:left; list-style:none; margin:10px;}
            #imgUl li img{width:200px; height:200px}
            #imgUl li:hover{ border-color: #9a9fa4; box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.85);}
            #imgUl .active{ border:1px dashed red;}
            #imgUl .imgtool{ width:20px; height:20px; float:right; z-index:999; position:relative; top:-200px; margin-right:3px; cursor:pointer; visibility:hidden}
            #imgUl .imgtool img{width:20px; height:20px; background:#FFF}


        </style>
        <input type="hidden" id="goodsid" value="0">
        <div id="contv0" style="display:; background:#FFF; padding-top:40px">
            <ul id="imgUl">

            </ul>
            <div style="width:80%; height:50px; padding:30px 0 0 40px; clear:both">
                <button class="btn0" style="width:100px" onClick="imgSave(2)">暂时保存</button>
                <button class="btn0" style="width:140px" onClick="imgSave(3)">保存并编辑完成</button>
                <button class="btn0" style="width:140px" onClick="updateColor()">图片去色设置</button>
                <button class="btn0" style="width:140px" onClick="anandon()">弃用</button>
            </div>
            <div style="width:100%; clear:both"></div>

        </div>

        <script>
            var dragImg0=0,dragImg1=0;
            var imgArr=new Array();
            var oUl ;
            var aLi ;
            var disX = 0;
            var disY = 0;
            var minZindex = 1;
            var aPos =[];
            var colors=new Array();

            // imgArr=["assets/img/goods.jpg","assets/img/goods1.jpg","assets/img/goods2.jpg","assets/img/goods3.jpg","assets/img/goods4.jpg","assets/img/goods5.jpg"];
            //图片显示
            //图片显示
            function showImg()
            {
                var s="";
                for(var i=0;i<imgArr.length;i++)
                {
                    s+="<li data-id='"+imgArr[i]+"'><img src='"+imgArr[i]+"'></li>";
                }
                $("#imgUl").html(s);


                oUl= document.getElementById("imgUl");
                aLi = oUl.getElementsByTagName("li");

                for(var i=0;i<aLi.length;i++){
                    var t = aLi[i].offsetTop;
                    var l = aLi[i].offsetLeft;
                    aLi[i].style.top = t+"px";
                    aLi[i].style.left = l+"px";
                    aPos[i] = {left:l,top:t};
                    aLi[i].index = i;
                }

                for(var i=0;i<aLi.length;i++){
                    aLi[i].style.position = "absolute";
                    aLi[i].style.margin = 0;
                    setDrag(aLi[i]);
                }

                $("#imgUl li").append("<div class='imgtool'><img src='assets/img/close.png' class='imgdel' title='删除'></div>");
                $(".imgdel").click(function(){
                    var li=$(this).parent().parent();
                    var id=$(this).parent().parent().attr("data-id");
                    goodsImgDel(id);
                    li.remove();
                    //debugger;
                    imgArr.splice(jQuery.inArray(id,imgArr),1);
                });

                $("#imgUl li").dblclick(function(){
                    var url=$(this).attr("data-id");
                    purchaseImgDetail(url)
                });

                //debugger;
                for(var inx=0;inx<colors.length;inx++){
                    var tmp1=colors[inx].split(',');
                    //debugger;
                    var img=tmp1[1].replace("imageUrl:","");
                    var colname=tmp1[0].split(':')[1];
                    $("#imgUl li").filter('[data-id="'+img+'"]').append("<div style='text-align:center;'>"+colname+"</div>");

                }


            }
            function loaddata()
            {
                var url = document.location.toString();
                var arrUrl = url.split("//");
                var goodsinfo = '';
                var start = arrUrl[1].indexOf("/");
                var relUrl = arrUrl[1].substring(start);//stop省略，截取从start开始到结尾的所有字符

                if (relUrl.indexOf("?") != -1) {
                    goodsinfo = relUrl.split("?")[1];
                }
                goodsid = "0";
                if (goodsinfo.indexOf("=") != -1) {
                    goodsid = goodsinfo.split("=")[1];
                }
                $("#goodsid").val(goodsid);
                ajaxH.post(urlH.purchase.detail(),{goodsid:goodsid},function(data) {
                    if(data.flag=="success"){
                        if(data.data!=null){
                            //debugger;
                            //alert(data.data.sku);
                            $("#sku").html(data.data.id);
                            var staval="";
                            switch(data.data.productStatus){
                                case 1:{
                                    staval="未编辑";break;
                                }
                                case 2:{
                                    staval="编辑中";break;
                                }
                                case 3:{
                                    staval="编辑完成";break;
                                }
                                case 4:{
                                    staval="弃用";break;
                                }
                            }
                            $("#editStatus").html(staval);

                            var s="";
                            if(String(data.data.skuUrl).indexOf("chinabrands")>0){
                                s="chinabrands";
                            }else{
                                s="1688";
                            }
                            $("#source").html(s);

                            $("#from").text(data.data.skuUrl);
                            $("#from").attr("href",data.data.skuUrl);
                            $("#createon").html(fmtDate(data.data.createdOn));
                            imgArr=data.data.bigImg.substring(0,data.data.bigImg.length-1).split(',');
                            if(data.data.props!=null && data.data.props.length>0)
                            {colors=data.data.props.split(';');}
                            showImg();
                            //imgArr=["/img/goods.jpg","/img/goods1.jpg","/img/goods2.jpg","/img/goods3.jpg","/img/goods4.jpg","/img/goods5.jpg"];
                            //showImg();
                            //imgArr= ["assets/img/goods.jpg","assets/img/goods1.jpg","assets/img/goods2.jpg","assets/img/goods3.jpg","assets/img/goods4.jpg","assets/img/goods5.jpg"];
                            oUl= document.getElementById("imgUl");
                            aLi = oUl.getElementsByTagName("li");

                            for(var i=0;i<aLi.length;i++){
                                var t = aLi[i].offsetTop;
                                var l = aLi[i].offsetLeft;
                                aLi[i].style.top = t+"px";
                                aLi[i].style.left = l+"px";
                                aPos[i] = {left:l,top:t};
                                aLi[i].index = i;
                            }

                            for(var i=0;i<aLi.length;i++){
                                aLi[i].style.position = "absolute";
                                aLi[i].style.margin = 0;
                                setDrag(aLi[i]);
                            }
                            //图片操作按钮 删除
                            //图片操作按钮 删除
                            /*
                            $("#imgUl li").append("<div class='imgtool'><img src='assets/img/close.png' class='imgdel' title='删除'></div>");
                            $(".imgdel").click(function(){
                                var li=$(this).parent().parent();
                                var id=$(this).parent().parent().attr("data-id");
                                goodsImgDel(id);
                                li.remove();
                                imgArr.splice(jQuery.inArray(id,imgArr),1);
                            });

                            $("#imgUl li").dblclick(function(){
                                var url=$(this).attr("data-id");
                                purchaseImgDetail(url)
                            });
                            */
                            /*
                            $("#imgUl li").append("<div class='imgtool'><img src='assets/img/close.png' class='imgdel' title='删除'></div>");
                            $(".imgdel").click(function(){
                                var li=$(this).parent().parent();
                                var id=$(this).parent().parent().attr("data-id");
                                goodsImgDel(id);
                                li.remove();
                                imgArr.splice(jQuery.inArray(id,imgArr),1);
                            });


                            $("#imgUl li").dblclick(function(){
                                var url=$(this).attr("data-id");
                                purchaseImgDetail(url)
                            });
                            */
                            //属性
                            $("#brand").val(data.data.brand);
                            $("#origin").val(data.data.origin);
                            $("#companycode").val(data.data.companycode);
                            $("#designer").val(data.data.designer);
                            $("#categoryName").val(data.data.categoryName);

                            $("#msrp").val(data.data.msrp);
                            $("#shipfee").val(data.data.shipfee);
                            $("#hscode").val(data.data.hscode);
                            $("#hschinese").val(data.data.hschinese);
                            $("#declarePrice").val(data.data.declarePrice);
                            $("#priceenglish").val(data.data.priceenglish);
                            $("#forpeople").val(data.data.forpeople);
                            $("#productmaterial").val(data.data.productMaterial);
                            $("#packagematerial").val(data.data.packageMaterial);
                            $("#packageDimensions").val(data.data.packageDimensions);
                            $("#shippingWeight").val(data.data.shippingWeight);
                            $("#stock").val(data.data.stock);
                            $("#numberOfItems").val(data.data.numberOfItems);

                            //alert(data.data.battery);
                            if(data.data.battery==1){
                                $("#battery").attr("checked",'true');
                            }else{
                                $("#battery").removeAttr("checked");
                            }
                            $("#catid").val(data.data.productClass);
                            $("#catname").html(showCatgory(data.data.productClass));

                            //文描
                            $("#chBulletPoint").val(data.data.chBulletPoint);
                            $("#chDescription").val(data.data.chDescription);
                            $("#chSearchTerms").val(data.data.chSearchTerms);
                            $("#chTitle").val(data.data.chTitle);

                            $("#frBulletPoint").val(data.data.frBulletPoint);
                            $("#frDescription").val(data.data.frDescription);
                            $("#frSearchTerms").val(data.data.frSearchTerms);
                            $("#frTitle").val(data.data.frTitle);

                            $("#deBulletPoint").val(data.data.deBulletPoint);
                            $("#deDescription").val(data.data.deDescription);
                            $("#deSearchTerms").val(data.data.deSearchTerms);
                            $("#deTitle").val(data.data.deTitle);

                            $("#esBulletPoint").val(data.data.esBulletPoint);
                            $("#esDescription").val(data.data.esDescription);
                            $("#esSearchTerms").val(data.data.esSearchTerms);
                            $("#esTitle").val(data.data.esTitle);

                            $("#jpBulletPoint").val(data.data.jpBulletPoint);
                            $("#jpDescription").val(data.data.jpDescription);
                            $("#jpSearchTerms").val(data.data.jpSearchTerms);
                            $("#jpTitle").val(data.data.jpTitle);

                            $("#itBulletPoint").val(data.data.itBulletPoint);
                            $("#itDescription").val(data.data.itDescription);
                            $("#itSearchTerms").val(data.data.itSearchTerms);
                            $("#itTitle").val(data.data.itTitle);

                            $("#BulletPoint").val(data.data.bulletPoint);
                            $("#Description").val(data.data.description);
                            $("#SearchTerms").val(data.data.searchTerms);
                            $("#Title").val(data.data.title);

                        }
                    }

                });

            }

            //拖拽
            function setDrag(obj){
                obj.onmouseover = function(){
                    obj.style.cursor = "move";
                    obj.getElementsByTagName("div")[0].style.visibility="visible";
                }
                obj.onmouseout=function()
                {
                    obj.getElementsByTagName("div")[0].style.visibility="hidden";
                };
                obj.onmousedown = function(event){
                    var scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
                    var scrollLeft = document.documentElement.scrollLeft||document.body.scrollLeft;
                    obj.style.zIndex = minZindex++;
                    dragImg0=obj.getAttribute("data-id");
                    //当鼠标按下时计算鼠标与拖拽对象的距离
                    disX = event.clientX +scrollLeft-obj.offsetLeft;
                    disY = event.clientY +scrollTop-obj.offsetTop;
                    document.onmousemove=function(event){
                        //当鼠标拖动时计算div的位置
                        var l = event.clientX -disX +scrollLeft;
                        var t = event.clientY -disY + scrollTop;
                        obj.style.left = l + "px";
                        obj.style.top = t + "px";
                        /*for(var i=0;i<aLi.length;i++){
                            aLi[i].className = "";
                            if(obj==aLi[i])continue;//如果是自己则跳过自己不加红色虚线
                            if(colTest(obj,aLi[i])){
                                aLi[i].className = "active";
                            }
                        }*/
                        for(var i=0;i<aLi.length;i++){
                            aLi[i].className = "";
                        }
                        var oNear = findMin(obj);
                        if(oNear){
                            oNear.className = "active";
                        }
                    }
                    document.onmouseup = function(){
                        document.onmousemove = null;//当鼠标弹起时移出移动事件
                        document.onmouseup = null;	//移出up事件，清空内存
                        //检测是否普碰上，在交换位置
                        var oNear = findMin(obj);
                        if(oNear){
                            dragImg1=oNear.getAttribute("data-id");

                            oNear.className = "";
                            oNear.style.zIndex = minZindex++;
                            obj.style.zIndex = minZindex++;
                            startMove(oNear,aPos[obj.index]);
                            startMove(obj,aPos[oNear.index]);
                            //交换index
                            oNear.index += obj.index;
                            obj.index = oNear.index - obj.index;
                            oNear.index = oNear.index - obj.index;
                        }else{

                            startMove(obj,aPos[obj.index]);
                        }
                    }
                    clearInterval(obj.timer);
                    return false;//低版本出现禁止符号
                }
            }
            //碰撞检测
            function colTest(obj1,obj2){
                var t1 = obj1.offsetTop;
                var r1 = obj1.offsetWidth+obj1.offsetLeft;
                var b1 = obj1.offsetHeight+obj1.offsetTop;
                var l1 = obj1.offsetLeft;

                var t2 = obj2.offsetTop;
                var r2 = obj2.offsetWidth+obj2.offsetLeft;
                var b2 = obj2.offsetHeight+obj2.offsetTop;
                var l2 = obj2.offsetLeft;

                if(t1>b2||r1<l2||b1<t2||l1>r2){
                    return false;
                }else{
                    return true;
                }
            }
            //勾股定理求距离
            function getDis(obj1,obj2){
                var a = obj1.offsetLeft-obj2.offsetLeft;
                var b = obj1.offsetTop-obj2.offsetTop;
                return Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
            }
            //找到距离最近的
            function findMin(obj){
                var minDis = 999999999;
                var minIndex = -1;
                for(var i=0;i<aLi.length;i++){
                    if(obj==aLi[i])continue;
                    if(colTest(obj,aLi[i])){
                        var dis = getDis(obj,aLi[i]);
                        if(dis<minDis){
                            minDis = dis;
                            minIndex = i;
                        }
                    }
                }
                if(minIndex==-1){
                    return null;
                }else{
                    return aLi[minIndex];
                }
            }

            //图片删除
            function goodsImgDel(id)
            {
                //数据库实际删除图片
            }
            //图片删除//

            function imgSave(status)
            {
                //debugger;
                var pos0=$.inArray(dragImg0,imgArr);
                var pos1=$.inArray(dragImg1,imgArr);

                imgArr[pos0] = dragImg1;
                imgArr[pos1] = dragImg0;

                purchaseH.updateimg($("#goodsid").val(),imgArr.join(',')+',',status,colors.join(';'));
            }

            function updateColor()
            {
                var aj = $.ajax({
                    url:'http://ssl1.zuzhiweiyuan.com/Spider1688/ImgColorUpdate',
                    type:'post',
                    data:{
                        Str:"http://www1.bnncar.com/img/goods1.jpg",
                        Nick:"#c7987a"
                    },
                    dataType:'json',
                    success:function(data) {
                        alert(data)
                    },
                    error:function(StatusCode) {
                        showErr(StatusCode,location.href)
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                    }
                });
            }

            function attrSave(status){
                //alert(status);
                var battery= $('#battery').prop('checked');
                var data={
                    id:$("#goodsid").val(),
                    productStatus:status,
                    brand:$("#brand").val(),
                    designer: $("#designer").val(),
                    categoryName:$("#categoryName").val(),
                    MSRP:$("#msrp").val(),
                    packageDimensions:$("#packageDimensions").val(),
                    shippingWeight:$("#shippingWeight").val(),
                    numberOfItems:$("#numberOfItems").val(),
                    origin:$("#origin").val(),
                    companycode: $("#companycode").val(),
                    shipfee:$("#shipfee").val(),
                    hscode:$("#hscode").val(),
                    hschinese:$("#hschinese").val(),
                    declarePrice:$("#declarePrice").val(),
                    priceenglish:$("#priceenglish").val(),
                    forpeople:$("#forpeople").val(),
                    ProductMaterial:$("#productmaterial").val(),
                    PackageMaterial:$("#packagematerial").val(),
                    stock:$("#stock").val(),
                    battery:battery?1:0,
                    productClass:$("#catid").val()
                };



                purchaseH.updateattr(data,status);

            }

            function descSave(contry,status){
                var BulletPoint="";
                var Description="";
                var SearchTerms="";
                var Title="";

                BulletPoint=$("#"+contry+"BulletPoint").val();
                Description=$("#"+contry+"Description").val();
                SearchTerms=$("#"+contry+"SearchTerms").val();
                Title=$("#"+contry+"Title").val();

                var data={
                    id:$("#goodsid").val(),
                    productStatus:status,
                    BulletPoint:BulletPoint,
                    Description:Description,
                    SearchTerms:SearchTerms,
                    Title:Title,
                    contry:contry
                };


                //alert(data.id);
                //alert(data.status);
                //debugger;
                purchaseH.updatedesc(data,status);

            }

            function translates(from,to) {
                var BulletPoint=$("#"+from+"BulletPoint").val();

                var Description=$("#"+from+"Description").val();
                var SearchTerms=$("#"+from+"SearchTerms").val();
                var Title=$("#"+from+"Title").val();

                var data={
                    bulletPoint:BulletPoint.replace(/\n/g,";"),
                    description:Description.replace(/\n/g,";"),
                    searchTerms:SearchTerms.replace(/\n/g,";"),
                    title:Title,
                    from:'auto',
                    to:'en'
                };
                purchaseH.translate(data);
            }
            loaddata();
            //更改分类，aid：现有亚马逊分类ukid；sid：本站商品分类ID
            function exGoodsCategory(sid)
            {
                var aid=$("#catid").val();
                var w=400;
                var h=600;
                popWin.scrolling="yes";
                var url="win_amazon.html?aid="+aid+"&sid="+sid;
                popWin.showWin(w,h,"亚马逊商品分类",url);
            }
            //得到新分类 arr：[[ukid,名称],[ukid,名称]]
            function getNewCategory(arr)
            {
                var id=name="";
                for(var i=0;i<arr.length;i++)
                {
                    if(i>0) { id+=",";name+="<br>";}
                    id+=arr[i][0];
                    name+=arr[i][1];
                }
                $("#catname").html(name);
                $("#catid").val(id);

                //ukid处理
            }
            function showCatgory(aids){
                if(aids==null)return;
                var ids=aids.split(',');
                var names='';
                for(var i=0;i<ids.length;i++){
                    for(var j=0;j<codeAmazonArr.length;j++){
                        if(ids[i]==codeAmazonArr[j][0]){
                            names+=codeAmazonArr[j][1]+'<br>';
                        }
                    }
                }
                return names;
            }
        </script>
        <!--//相册-->
        <!--属性-->
        <div id="contv1" style=" display:none">
            <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                <tbody>
                <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                <tr>
                    <td class="tdn ntd" style="width:75px">商品类别</td>
                    <td><div id="catname" style="width:460px; float:left">板球/服装/女人/帽子<br>
                        自行车/服装/女帽/头饰/头带</div>
                        <button class="btn0" onClick="exGoodsCategory(1)" style="float:left">修改</button>
                        <input type="hidden" id="catid" value="">
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">品牌名称</td>
                    <td><input id="brand" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">原产地区</label>
                        <input id="origin" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">厂商编号</td>
                    <td><input id="companycode" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">厂商名称</label>
                        <input id="designer" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">商品目录</td>
                    <td><input id="categoryName" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">采购单价</td>
                    <td><input id="msrp" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">物流费用</label>
                        <input id="shipfee" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">海关编码</td>
                    <td><input id="hscode" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">—中文—</label>
                        <input id="hschinese" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">申报单价</td>
                    <td><input id="declarePrice" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">—英文—</label>
                        <input id="priceenglish" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">适用人群</td>
                    <td><input id="forpeople" type="text" style="width:268px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">产品材料</td>
                    <td><input id="productmaterial" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">包装材料</label>
                        <input id="packagematerial" type="text" style="width:270px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">包装尺寸</td>
                    <td><input id="packageDimensions" type="text"  style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl" style=" margin-left:18px">包装毛重</label>
                        <input id="shippingWeight" type="text" style="width:100px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" /> 克
                        <label style="margin-left:30px"><input id="battery" type="checkbox">有电池</label>
                    </td>
                    </td>
                </tr>
                <tr>
                    <td class="tdn ntd">库存数量</td>
                    <td><input id="stock" type="text" style="width:150px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" />
                        <label class="lbl">产品数/包</label>
                        <input id="numberOfItems" type="text" style="width:265px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';" /></td>
                    </td>
                </tr>
                <tr><td>&nbsp;</td><td>
                    <button class="btn0" style="width:100px" onClick="attrSave(2)">暂时保存</button>
                    <button class="btn0" style="width:140px" onClick="attrSave(3)">保存并编辑完成</button>


                </td>
                </tr>
                <tr><td height="30" colspan="2">&nbsp;</td></tr>
                </tbody>
            </table>
        </div>
        <!--//属性-->
        <!--文描-->
        <div id="contv2" style="display:none; background:#FFF;padding-top:20px">
            <!--Tab-->
            <style>
                #contv2 textarea{ margin-bottom:10px}
                .mt10{width:40px; height:28px; line-height:28px; float:left; margin:0; color:#323437}
                .mt11{ border-top:0.5px solid #e1e3e4; border-bottom:0.5px solid #e1e3e4; width:50px; height:28px; text-align:center;float:left; line-height:28px; margin:0; color:#323437; border-color:#e1e3e4; cursor:pointer}
                .mt12{ border-top:0.5px solid #e1e3e4; border-bottom:0.5px solid #e1e3e4; width:50px; height:28px; text-align:center;float:left; line-height:28px; margin:0; color:#FFF; background:#4aa6fc; border-color:#4aa6fc}
                .btns{background:#FFF;border:1px solid #CCC;height:26px;font-size:12px;padding:0px 5px 0px 5px; color:#FFF;font-family:微软雅黑;border-radius:2px; color:#4f97e7}
            </style>
            <div id="tabtitlng" style="width:500px; padding-left:118px">
                <div class="mt12" id="tablng0" onClick="clkTabLng(0)" style=" border-left-style:solid; border-left-width:thin; border-top-left-radius:2px; border-bottom-left-radius:2px">中文</div>
                <div class="mt11" id="tablng1" onClick="clkTabLng(1)">英文</div>
                <div class="mt11" id="tablng2" onClick="clkTabLng(2)">法文</div>
                <div class="mt11" id="tablng3" onClick="clkTabLng(3)">德文</div>
                <div class="mt11" id="tablng4" onClick="clkTabLng(4)">意大利</div>
                <div class="mt11" id="tablng5" onClick="clkTabLng(5)">西班牙</div>
                <div class="mt11" id="tablng6" onClick="clkTabLng(6)" style="border-right-style:solid;border-right-width:thin; border-top-right-radius:2px; border-bottom-right-radius:2px;">日语</div>
            </div>
            <!--//Tab-->
            <!--中文-->
            <div id="contvlng0" style="display:">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><div style="width:810px; float:left"><textarea id="chTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></div>
                            <div style=" float:left; width:400px">
                                <p><button class="btns" style="width:50px" onClick="batchDel('chTitle')">删除</button></p>
                                <p><label id="chTitLab" style="display:none">
                                    <textarea id="chTitOri" class="txt0" placeholder="被替换的内容" style="width:140px; height:40; line-height:20px"></textarea>
                                    <textarea id="chTitNew" class="txt0" placeholder="替换后的内容" style="width:140px"></textarea></label>
                                    <button class="btns" style="width:50px;" onClick="batchReplace('chTitle')" onMouseOver="chChTitLabShow()">替换</button></p>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="chSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="chBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><div style="width:810px; float:left"><textarea id="chDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></div>
                            <div style=" float:left; width:400px">
                                <p><button class="btns" style="width:50px" onClick="batchDel('chDescription')">删除</button></p>
                                <p><label id="chDesLab" style="display:none">
                                    <textarea id="chDescriptionOri" class="txt0" placeholder="被替换的内容" style="width:140px; height:40; line-height:20px"></textarea>
                                    <textarea id="chDescriptionNew" class="txt0" placeholder="替换后的内容" style="width:140px"></textarea></label>
                                    <button class="btns" style="width:50px;" onClick="batchReplace('chDescription')" onMouseOver="chDescLabShow()">替换</button></p>
                            </div>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('ch',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('ch',3)">保存并编辑完成</button>
                        <button class="btn0" style="width:140px" onClick="translates('ch','en')">翻译</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//中文-->
            <script>
                function chChTitLabShow()
                {
                    $("#chTitLab").css("display","block");
                    var s=selTxt(document.getElementById("chTitle"));
                    $("#chTitOri").val(s);
                }
                function chDescLabShow()
                {
                    $("#chDesLab").css("display","block");
                    var s=selTxt(document.getElementById("chDescription"));
                    $("#chDescriptionOri").val(s);
                }
                function selTxt(o)
                {
                    if (window.getSelection)
                    {
                        if (o.selectionStart != undefined && o.selectionEnd != undefined)
                        {
                            return o.value.substring(o.selectionStart, o.selectionEnd);
                        } else {
                            return "";
                        }
                    } else
                    {
                        return document.selection.createRange().text;
                    }
                }
                function batchDel(id)
                {
                    var tobj=document.getElementById(id);
                    var oriv=selTxt(tobj);
                    var s=new RegExp(oriv,'g');
                    switch(id)
                    {
                        case 'chTitle':

                            $("#chTitle").val($("#chTitle").val().replace(s,''));
                            batchData('chTitle',oriv,'');
                            break;
                        case 'chDescription':
                            $("#chDescription").val($("#chDescription").val().replace(s,''));
                            batchData('chDescription',oriv,'');
                            break;
                    }
                }
                function batchReplace(id)
                {
                    switch(id)
                    {
                        case 'chTitle':
                            var oriv=$("#chTitOri").val();
                            var repv=$("#chTitNew").val();

                            var s =new RegExp(oriv,'g');
                            $("#chTitle").val($("#chTitle").val().replace(s,repv));
                            batchData('ch_title',oriv,repv);
                            break;
                        case 'chDescription':
                            var oriv=$("#chDescriptionOri").val();
                            var repv=$("#chDescriptionNew").val();
                            var s =new RegExp(oriv,'g');
                            $("#chDescription").val($("#chDescription").val().replace(s,repv));
                            batchData('ch_description',oriv,repv);
                            break;
                    }
                }
                //id:textarea的id字符串，oriv:被替换的字符,repv:替换后的字符，如是删除，则为''
                function batchData(id,oriv,repv)
                {
                    //数据库指定字段替换操作
                    var data={
                        id:$("#goodsid").val(),
                        productStatus:2,
                        item:id,
                        oriv:oriv,
                        repv:repv
                    };


                    //alert(data.id);
                    //alert(data.status);

                    purchaseH.updateChdesc(data);
                    showWarning(1500,"操作完成",200,60);
                    $(".tips").fadeOut(2000);
                }

                function anandon(){
                    var ids=$("#goodsid").val();
                    purchaseH.updatestatus(ids,4);
                    $("#editStatus").html("弃用");
                    showWarning(1500,"操作完成",200,60);
                    $(".tips").fadeOut(2000);
                }
            </script>
            <!--英文-->
            <div id="contvlng1" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="Title" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="SearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="BulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="Description" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//英文-->
            <!--法文-->
            <div id="contvlng2" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="frTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="frSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="frBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="frDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('fr',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('fr',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//法文-->
            <!--德文-->
            <div id="contvlng3" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="deTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="deSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="deBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="deDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('de',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('de',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//德文-->
            <!--意大利-->
            <div id="contvlng4" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="itTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="itSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="itBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="itDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('it',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('it',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//意大利-->
            <!--西班牙-->
            <div id="contvlng5" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="esTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="esSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="esBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="esDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('es',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('es',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//西班牙-->
            <!--日语-->
            <div id="contvlng6" style="display:none">
                <table class="info infoedit" cellspacing="0" cellpadding="0" style="display:;">
                    <tbody>
                    <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
                    <tr>
                        <td class="tdn ntd" style="width:75px">商品标题</td>
                        <td><textarea id="jpTitle" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">关键词</td>
                        <td><textarea id="jpSearchTerms" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">要点说明</td>
                        <td><textarea id="jpBulletPoint" style="width:800px; height:80px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr>
                        <td class="tdn ntd">产品描述</td>
                        <td><textarea id="jpDescription" style="width:800px; height:320px" class="txt0" onMouseOver="this.className='txt1';" onMouseOut="this.className='txt0';"></textarea></td>
                    </tr>
                    <tr><td>&nbsp;</td><td>
                        <button class="btn0" style="width:100px" onClick="descSave('jp',2)">暂时保存</button>
                        <button class="btn0" style="width:140px" onClick="descSave('jp',3)">保存并编辑完成</button>
                    </td>
                    </tr>
                    <tr><td height="30" colspan="2">&nbsp;</td></tr>
                    </tbody>
                </table>
            </div>
            <!--//日语-->

        </div>
        <div style="clear:both"></div>
        <!--//文描-->
    </div>
</div>
<script>
    //标签切换
    function clkTabLng(p)
    {
        for(var i=0;i<7;i++)
        {
            document.getElementById("tablng"+i).className="mt11";
            document.getElementById("contvlng"+i).style.display="none";
        }
        document.getElementById("tablng"+p).className="mt12";
        document.getElementById("contvlng"+p).style.display="block";
    }

    function clkTab(p)
    {
        var l=3
        for(var i=0;i<l;i++)
        {
            document.getElementById("tab"+i).className="tab0";
            document.getElementById("contv"+i).style.display="none";
        }
        document.getElementById("tab"+p).className="tab1";
        document.getElementById("contv"+p).style.display="block";
    }
    //标签切换//




    // imgArr=["assets/img/goods.jpg","assets/img/goods1.jpg","assets/img/goods2.jpg","assets/img/goods3.jpg","assets/img/goods4.jpg","assets/img/goods5.jpg"];	//数据库取图片初始数组排序





</script>
</body>
</html>